package com.yl.auth.controller;


import com.yl.auth.entity.HugongfuwuBean;
import com.yl.auth.service.HugongfuwuService;
import com.yl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ln
 * @since 2023-06-25
 */
@Api(tags = "市场销售-积分模块")
@RestController
@RequestMapping("/admin/auth/jifen")
public class JifenController {

    @Autowired
    private HugongfuwuService hugongfuwuService;

    @ApiOperation("查询全部信息")
    @GetMapping("/list")
    public Result list(){
        List<HugongfuwuBean> list = hugongfuwuService.getAll();
        return Result.ok(list);
    }
    @ApiOperation("根据id查询")
    @GetMapping("/getById/{id}")
    public Result getById(@PathVariable Long id){
        HugongfuwuBean byId = hugongfuwuService.getById(id);
        return Result.ok(byId);
    }
    @ApiOperation("根据id修改")
    @PostMapping("/updateById")
    private Result updateById(@RequestBody HugongfuwuBean hugongfuwuBean){
        hugongfuwuService.updateById(hugongfuwuBean);
        return Result.ok();
    }
    @ApiOperation("修改人民币积分比率")
    @PostMapping("/update")
    private Result update(@RequestBody HugongfuwuBean hugongfuwuBean){
        hugongfuwuService.updateJiFen(hugongfuwuBean);
        return Result.ok();
    }
    @ApiOperation("修改对应护理服务的积分")
    @PostMapping("/updateByHid")
    private Result updateByHId(@RequestBody HugongfuwuBean hugongfuwuBean){
        hugongfuwuService.updateByHid(hugongfuwuBean);
        return Result.ok();
    }

}

